<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="text/javascript">
    var arr = [3,4,3,5,7,9];
    var a=0;
    for (var i = 0; i <arr.length ; i++) {
        if (arr[i]==3){
            a++;
        }
    }
    alert(a);
</script>
</body>
</html>